package com.qf.example.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.example.mapper.SysModuleMapper;
import com.qf.example.model.SysModule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/sysModule")
public class SysModuleController {
    @Autowired
    private SysModuleMapper sysModuleMapper;

    @RequestMapping("/findAll")
    @ResponseBody
    public List<SysModule> findAll() {
        return sysModuleMapper.selectAll();
    }

    @RequestMapping("/findPage")
    @ResponseBody
    public PageInfo<SysModule> findPage(Integer page, Integer rows) {
        PageHelper.startPage(page, rows);
        List<SysModule> list = sysModuleMapper.selectAll();
        return new PageInfo<>(list);
    }
}
